/**
 * \file
 * \brief Python Wrap of Image Conversions class
 * \author Antti Maula <antti.maula@tkk.fi>
 * \author Tapio Taipalus <tapio.taipalus@tkk.fi>
 *
 */
%{
	#include "ImageTypes.hpp"
	#include "ImageConversion.hpp"
%}
%include "ImageTypes.i"

namespace MaCI {
  namespace Image {
    
    class CImageConversion {
    public:

      CImageConversion();
      ~CImageConversion();
      CImageConversion(const CImageConversion &);
      CImageConversion &operator=(const CImageConversion &);

	  bool ConvertImageData(const MaCI::Image::EImageDataType aSrcType, 
                            const MaCI::Image::EImageDataType aDestType,
                            const unsigned int aWidth, 
                            const unsigned int aHeight,
                            const unsigned char *aInputPtr, 
                            const unsigned int aInputSize,
                            unsigned char **aOutputPtrPtr,
                            unsigned int *aOutputSizePtr);
    private:
      unsigned char *iTemporary_buffer; ///< Temporary buffer for any operation requiring it.
      unsigned int iTemporary_buffer_size; ///< Size of temp buffer.
      
    private:
      void ReserveTemporary(const unsigned int aBytes);

      // Specialized converters.
      bool ConvertImageData_JPEG_to_RGB(const unsigned int aWidth, 
                                        const unsigned int aHeight,
                                        const unsigned char *aInputPtr, 
                                        const unsigned int aInputSize,
                                        unsigned char **aOutputPtrPtr,
                                        unsigned int *aOutputSizePtr);
      bool ConvertImageData_RGB_to_JPEG(const unsigned int aWidth, 
                                        const unsigned int aHeight,
                                        const unsigned char *aInputPtr, 
                                        const unsigned int aInputSize,
                                        unsigned char **aOutputPtrPtr,
                                        unsigned int *aOutputSizePtr);
      
      bool ConvertImageData_RGB_to_PNG(const unsigned int aWidth, 
                                       const unsigned int aHeight,
                                       const unsigned char *aInputPtr, 
                                       const unsigned int aInputSize,
                                       unsigned char **aOutputPtrPtr,
                                       unsigned int *aOutputSizePtr);
      bool ConvertImageData_PNG_to_RGB(const unsigned int aWidth, 
                                       const unsigned int aHeight,
                                       const unsigned char *aInputPtr, 
                                       const unsigned int aInputSize,
                                       unsigned char **aOutputPtrPtr,
                                       unsigned int *aOutputSizePtr);

      bool ConvertImageData_YUV420P_to_JPEG(const unsigned int aWidth, 
                                            const unsigned int aHeight,
                                            const unsigned char *aInputPtr, 
                                            const unsigned int aInputSize,
                                            unsigned char **aOutputPtrPtr,
                                            unsigned int *aOutputSizePtr);
      bool ConvertImageData_YUV422_to_JPEG(const unsigned int aWidth, 
                                           const unsigned int aHeight,
                                           const unsigned char *aInputPtr, 
                                           const unsigned int aInputSize,
                                           unsigned char **aOutputPtrPtr,
                                           unsigned int *aOutputSizePtr);
      bool ConvertImageData_Greyscale_to_JPEG(const unsigned int aWidth, 
                                              const unsigned int aHeight,
                                              const unsigned char *aInputPtr, 
                                              const unsigned int aInputSize,
                                              unsigned char **aOutputPtrPtr,
                                              unsigned int *aOutputSizePtr);
    };
  }
}
